function imgCorrected = radialCorrection(img,k,type)

if(strcmp(type,'L1'))
    if(length(k)>1)
        fprintf('error');
        return
    end
    
    %xu  = xd/(1+lamda*r^2);
    %yu  = yd/(1+lamda*r^2);
    width = size(img,2);
    height = size(img,1);
    x0 = width/2;
    y0 = height/2;
    
    [Xd,Yd] = meshgrid(1:width,1:height);
    
    denom = (1+k*((Xd-x0).^2.+(Yd-y0).^2));
    Xu = (Xd-x0)./denom+x0;
    Yu = (Yd-y0)./denom+y0;
    %Xu = reshape(Xu,size(Xu,1)*size(Xu,2),1);
    %Yu = reshape(Yu,size(Yu,1)*size(Yu,2),1);

	imgCorrected = uint8(interpolateImg(img,Xu,Yu));
end